home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2395 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  648 b 

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: babycox@aol.com (BabyCox)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: quick decision: is n a power of 2?
  5. Date: 20 Jan 1996 22:02:48 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4dsaco$a39@newsbf02.news.aol.com>
  9. References: <4dpd94$c25@fountain.mindlink.net>
  10. Reply-To: babycox@aol.com (BabyCox)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. I'm sorry, 
  14.  
  15. Here is a revision, this should work (but that's what I said last time)
  16.  
  17. Boolean isPowerOfTwo(long x)
  18. {
  19.   long tst;
  20.   for(tst=1<<31;tst!=0;tst>>=1)
  21.     if (x==tst) return true;
  22.   
  23.   return false;
  24. }
  25.